package org.easy.bytefaceswap;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
@EnableConfigurationProperties({FaceSwapProperties.class})
@ConditionalOnProperty(prefix = FaceSwapProperties.PREFIX, name = "enabled", havingValue = "true")
public class FaceSwapConfiguration {

    @Resource
    private FaceSwapProperties faceSwapProperties;


    @Bean
    public FaceSwapTemplate volcEngineSignerTemplate() {
        FaceSwapClient faceswapClient = new FaceSwapClient(faceSwapProperties.getAccessKeyID(), faceSwapProperties.getSecretAccessKey(), faceSwapProperties.getRegion(), faceSwapProperties.getService());
        return new FaceSwapTemplate(faceswapClient);
    }
}
